
var thmListDataObj={'actDate':'','cityCode':"110100",'labels':[],'orderBy':1,'pageNum':1,'pageSize':10};
var pageLiArr = [
	// {zcId:'tg_theme',zcHref:''}
];			
		


var ThemeLine = {
	template:`<div class="template_wp">
				<div class="evy_thm_wp" v-for='obj of pageRenderArr' @click=onEvyThmClk(obj.higoId)>
					<div class="pic_wp"><img :src='imgSrc(obj)'></div> 
					<div class="itm_scan_wp">
						<div class="itm_title">{{obj.name}}</div>
						<div class="itm_thms clearfix">
							<span class="evy_thm" v-for='tag of obj.tag'>{{tag}}</span>
						</div>
						<div class="start_place">{{obj.startCity}}</div>
					</div>
					<div class="itm_price">￥{{obj.price}}<span class="price_word">起</span></div>
					<div class="rubbish_pm_img" v-if='mayShowImg(obj)'><img src="../img/bye_bye.png"/></div>
				</div>
			 </div>`,
			
	data:function() {
		return {
			theme_list_url:serveUrl()+'/api/higo/getlisthtml',
			theme_aty_id : [751,752,755,769,764,763,758,761,762,759,753,754,768,765,757,619],//添加了测试数据619，需删除
			thm_list_data:thmListDataObj,
			pageRenderArr:[],

		}
	},
	computed:{
		testA:function() {
			return true;
		}
	},
	methods: {
		getLineList:function() {

			var vm=this;
			vm.$http.post(vm.theme_list_url, vm.thm_list_data).then(
				function(res) {
					console.log(res);
					var data = res.body;
					vm.pageRenderArr=vm.pageRenderArr.concat(data.pageInfo.list);
					console.log(this.pageRenderArr);
				},function(xhr) {
					console.log('ajax error');
				}
			);
		},
		imgSrc:function(obj) {
			return obj.titlePic;
		},
		mayShowImg:function(obj) { //需要传递参数，不能写在计算属性里@zc
			// console.log(obj.higoId);//依次对应输出
			if(this.theme_aty_id.indexOf(obj.higoId)>0) {
				return true;
			}else {
				return false;
			}
		},
		onEvyThmClk:function(id) {
			console.log(id)
		}
	},
	// created:function() { //导航后获取数据@zc
	// 	// console.log(this.pageRenderArr);
	// 	this.getLineList();
		
	// },
	beforeRouteEnter:function(to,from,next) { //导航前获取数据@zc
		next(vm=>{
			// app.masker=false;//可以通过根实例的变量app直接访问根实例new Vue(obj);
			vm.getLineList();
		})
	},
	beforeRouteLeave :function(to,from,next) {
		app.list_name='主题线路';
		next();
	}
};
var LocalActivityList = {
	template:`<div>{{asd}}</div>`,
	data:function() {
		return {asd:'123'};
	},
	methods:{
		fixasd:function() {
			this.asd='789';
		}
	},
	beforeRouteEnter:function(to,from,next) {
		next(vm=>{
			// console.log(vm.$el);
			app.masker=false;
			vm.fixasd();
			app.list_name='当地活动';
		})
	},

};
var LocalGuideList = {
	template:`<div>LocalGuideList</div>`,
	// created:function() { //app实例还未创建此时list_name不能访问
	// 	app.list_name='当地向导';
	// },
	beforeRouteEnter:function(to,from,next) {
		next(vm=>{
			app.list_name='当地向导';
		})
	},
};   
var Impression = {
	template:`<div>Impression</div>`,
	// created:function(){
	// 	app.list_name='印象随笔';
	// },
	beforeRouteEnter:function(to,from,next) {
		next(vm=>{
			app.list_name='印象随笔';
		})
	},
};
var Note = {
	template:`<div>Note</div>`,
	// created:function() {
	// 	app.list_name='游记攻略';
	// },
	beforeRouteEnter:function(to,from,next) {
		next(vm=>{
			app.list_name='游记攻略';
		})
	},
};

var routes = [
  { path: '/theme_line', component: ThemeLine },
  { path: '/local_activity_list', component: LocalActivityList },
  { path: '/local_guide_list', component: LocalGuideList },
  { path: '/impression', component: Impression },
  { path: '/note', component: Note }
]
var router = new VueRouter({
	routes:routes
});

var app = new Vue({
	el:'#travel_list',
	router:router,
	data:{
		list_name:'主题线路',
		city_name:'北京',
		
		masker:false,


	},
	methods:{
		
		onHeadTitleTouch:function() {
			this.masker=!this.masker;
		},
		fixHeadTitle:function(title) {
			this.list_name=title;
			this.masker=false;
		}
	},
	computed:{
		isIos:function() {
			var u = navigator.userAgent;
			var tag = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
			return tag;
		},
		wrapMt:function() {
			return this.isIos?'5.35rem':'4.35rem';//苹果系统多出20像素（1rem）
		},
		titleUlTop:function() {
			return this.isIos?'3.2rem':'2.2rem';
		}
	},
	// created:function() {
	// 	this.getLineList();
	// }
});

